import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '../views/user/login.vue' // 登陆页
import user from '../views/user/user.vue' // 用户页
import home from '../views/home/index.vue' // 首页
import mainCount from '../views/home/mainCount.vue' // 首页图形页
import comment from '../views/comment/comment.vue' // 评论列表页
import articleRelease from '../views/article/articleRelease.vue' // 文章发表页
import articleList from '../views/article/articleList.vue' // 文章列表总览页
import articleCategory from '../views/article/articleCategory.vue' // 文章类别管理页

Vue.use(VueRouter)

// 路由配置
const routes = [
  {
    name: 'login', // 登陆页
    path: '/login',
    component: login
  },
  {
    name: 'home', // 首页
    path: '/home',
    component: home,
    children: [
      {
        name: 'user', // 用户页
        path: '/user',
        component: user
      },
      {
        name: 'mainCount', // 首页图形页
        path: '/mainCount',
        component: mainCount
      },
      {
        name: 'comment', // 评论列表页
        path: '/comment',
        component: comment
      },
      {
        name: 'articleRelease', // 文章发表页
        path: '/articleRelease',
        component: articleRelease
      },
      {
        name: 'articleList', // 文章发表页
        path: '/articleList',
        component: articleList
      },
      {
        name: 'articleCategory', // 文章类别管理页
        path: '/articleCategory',
        component: articleCategory
      },
      {
        path: '/',
        redirect:'/mainCount'
      }
    ]
  },
  {
    path: '/',
    redirect:'/home'
  }
]

const router = new VueRouter({
  routes
})

export default router
